﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading.Tasks;

namespace _03_ReadingAllTextOfAFile
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.Write("Enter the full path of a file: ");
                string fileName = Console.ReadLine();

                string fileContent = File.ReadAllText(fileName);

                Console.WriteLine("\nFile content:\n");
                Console.Write(fileContent);
                Console.WriteLine();
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);
            }           
            catch (PathTooLongException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (DirectoryNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }            
            catch (UnauthorizedAccessException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (NotSupportedException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (SecurityException e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                Console.WriteLine("Finishing the program");
            }
        }
    }
}
